﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LoginForm
{
    public partial class TimePage : MyFormPage
    {
        public TimePage()
        {
            InitializeComponent();
            this.pnl = pnlSchedule;
            fillTableSchedule();
        }
        private void fillTableSchedule(){
            DataTable table = new DataTable();
            table.Columns.Add("STT");
            table.Columns.Add("Thời Gian");
            table.Columns.Add("Thứ Hai");
            table.Columns.Add("Thứ Ba");
            table.Columns.Add("Thứ Tư");
            table.Columns.Add("Thứ Năm");
            table.Columns.Add("Thứ Sáu");
            table.Columns.Add("Thứ Bảy");
            table.Columns.Add("Chủ Nhật");
            List<List<Schedule>> timeJobs = SunnyIO.GetTimeJobs(FileName.schedule);
            for (int i = 0; i < timeJobs.Count; i++)
			{
                DataRow row = table.NewRow();
                row[0] = i + 1;
                row[1] = timeJobs[0][i].Time;
                row[2] = timeJobs[0][i].Student;
                row[3] = timeJobs[1][i].Student;
                row[4] = timeJobs[2][i].Student;
                row[5] = timeJobs[3][i].Student;
                row[6] = timeJobs[4][i].Student;
                row[7] = timeJobs[5][i].Student;
                row[8] = timeJobs[6][i].Student;
                table.Rows.Add(row);
			}                     

            dataGridView1.DataSource = table;            
            dataGridView1.Columns[0].Width = 25;
            dataGridView1.Columns[1].Width = 132;
            dataGridView1.Columns[2].Width = 132;
            dataGridView1.Columns[3].Width = 132;
            dataGridView1.Columns[4].Width = 132;
            dataGridView1.Columns[5].Width = 132;
            dataGridView1.Columns[6].Width = 132;
            dataGridView1.Columns[7].Width = 132;
            dataGridView1.Columns[8].Width = 132;

        }
        
        

    }
}
